import Vue from 'vue'
import iView from 'iview'
// import ElementUI from 'element-ui'
// import "element-ui/lib/theme-chalk/index.css";
import User from './entry/User.vue'
// import 'iview/dist/styles/iview.css'
import router from './router/user.router.js'
import axios from 'axios'
import Qs from 'qs'
import VueAxios from 'vue-axios'
import $ from 'jquery' ;
// import 'bootstrap'
import'../node_modules/bootstrap/dist/css/bootstrap.min.css';

import '../node_modules/bootstrap/dist/js/bootstrap.min.js';


import easynews from './views/user/projectdetail/easynews.js'
import authorizenews from './views/user/projectdetail/authorizenews.js'
import finacenews from './views/user/projectdetail/finacenews.js'
import projectprogress from './views/user/projectdetail/projectprogress.js'
import principaltable from './views/user/organizetable/principaltable.js'
import authorizetable from './views/user/organizetable/authorizetable'

import IP from '../src/views/IP/IP.vue'
import common  from "./views/common/common";
import '../my-theme/index.less'

Vue.prototype.common=common
Vue.prototype.IP=IP
Vue.config.productionTip = false;
Vue.use(iView);
Vue.use(easynews);
Vue.use(authorizenews);
Vue.use(finacenews);
Vue.use(projectprogress);
// Vue.use(ElementUI)
Vue.use(principaltable);
Vue.use(authorizetable);

Vue.prototype.setCookie=function(cname, cvalue, exminutes,path) {
    var millisecond = new Date().getTime();
    var expiresTime = new Date(millisecond + 60 * 1000 * exminutes);
    document.cookie="admin="+this.formInline.user+";path="+path+";expires="+expiresTime
}
//获取cookie
Vue.prototype.getCookie= function(cname) {
　　var name = cname + "=";
　　var ca = document.cookie.split(";");
　　for (var i = 0; i < ca.length; i++) {
　　var c = ca[i];
　　while (c.charAt(0) == " ") c = c.substring(1);
　　if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
}
return "";
}
//清除cookie
Vue.prototype.clearCookie= function() {
　　this.setCookie("username", "", -1);
}
var axios_instance = axios.create({
baseURL:'http://47.101.180.43:8080', //自行修改url,
transformRequest: [function (data) {
data = Qs.stringify(data);
return data;
}],
headers:{'Content-Type':'application/x-www-form-urlencoded',
'Access-Control-Allow-Credentials': 'true'}
})

Vue.use(VueAxios, axios_instance)
/**axios不是vue插件，所以需要这样配置，可以通过this.$http代替axios，而不用每个.vue里面再去import axios了 */
Vue.prototype.$ajax=axios
/**运行跨域请求*/
axios.defaults.withCredentials=true

new Vue({
    router,
    render:(h) => h(User)
}).$mount('#app');